package com.xiaoyu.awakening.ai.search.context;

import cn.hutool.core.lang.UUID;
import com.xiaoyu.awakening.ai.control.entity.*;
import com.xiaoyu.awakening.ai.search.model.AwkCallbackResult;
import com.xiaoyu.awakening.ai.search.model.AwkIntentionDetect;
import com.xiaoyu.awakening.ai.search.model.dto.SearchResultDTO;
import com.xiaoyu.awakening.ai.search.model.vo.SearchRequestVO;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * AwkSearchContext
 *
 * @author wangxiaoyu
 * @date 2024/7/18 11:41
 * @since v1.0
 */
@Data
public class AwkSearchContext<T> {
    private String searchId;

    private SearchRequestVO sourceSearchRequest;
    private List<AwkIntentionDetect> intentionDetectList;
    private List<AwkCallbackRoute> callbackRoutes;
    private List<AwkRankDefinition> rankDefinitions;

    private List<AwkCallbackResult> callbackResults;
    private SearchResultDTO<T> hitResult;

    public AwkSearchContext(SearchRequestVO sourceSearchRequest) {
        this.sourceSearchRequest = sourceSearchRequest;
        this.init();
    }

    private void init() {
        initSearchId();
        this.intentionDetectList = new ArrayList<>();
        this.callbackRoutes = new ArrayList<>();
        this.callbackResults = new ArrayList<>();
    }

    private void initSearchId() {
        this.searchId = UUID.fastUUID().toString();
    }
}
